﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using Common;


namespace WebSite.Core
{
    /// <summary>
    ///Converter 的摘要说明
    /// </summary>
    public static class ConverterHelper
    {
        /// <summary>
        /// 数字格式化
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static string formatNum(int num)
        {
            StringBuilder sb = new StringBuilder();
            string tmpNum = num.ToString();
            return tmpNum;
        }

  
        /// <summary>
        /// 城市类别To名字
        /// </summary>
        /// <param name="race"></param>
        /// <returns></returns>
        public static string CityIdToName(int id)
        {
            string cityname = string.Empty;
            switch (id)
            {
                case 0:
                    cityname = "上海";
                    break;
                case 1:
                    cityname = "沈阳";
                    break;
                case 2:
                    cityname = "北京";
                    break;
                case 3:
                    cityname = "深圳";
                    break;
                case 4:
                    cityname = "宁波";
                    break;
                case 5:
                    cityname = "成都";
                    break;
            }
            return cityname;
        }

        /// <summary>
        /// 城市名字To类别Id
        /// </summary>
        /// <param name="cityname"></param>
        /// <returns></returns>
        public static int CityNameToId(string cityname)
        {
            int cityId = 0;

            switch (cityname)
            {
                case "上海":
                    cityId = 0;
                    break;
                case "沈阳":
                    cityId = 1;
                    break;
                case "北京":
                    cityId = 2;
                    break;
                case "深圳":
                    cityId = 3;
                    break;
                case "宁波":
                    cityId = 4;
                    break;
                case "成都":
                    cityId = 5;
                    break;
            }
            return cityId;
        }

 

    }

}